#include "com.h"

int main()
{
  key_t key = ftok(PATH_NAME, PROJ_ID);
  if(key == -1){
    perror("ftok");
    return 1;
  }

  int shmid = shmget(key, SIZE, IPC_CREAT);
  if(shmid < 0){
    perror("shmget");
    return 2;
  }

  char* shmaddr = shmat(shmid, NULL, 0);
  int i = 0;
  while(1){
    shmaddr[i] = 'A' + i;
    i++;
    shmaddr[i] = 0;
    sleep(1);
  }
 
  shmdt(shmaddr);

  return 0;
}
